# B/S
# b browser
# s server

# http request  http请求
# http response http响应

import socket
sk = socket.socket()
sk.bind(('127.0.0.1',9000))
sk.listen()
try:
    conn,addr = sk.accept()
    ret = conn.recv(1024)
    conn.send(b'HTTP/1.1 200 OK \r\n\r\n')
    # conn.send('你好'.encode('GBK'))    # bytes
    with open('new.html',encoding='utf-8') as f:
        conn.send(f.read().encode('GBK'))
except Exception as e:
    print(e)
finally:
    conn.close()
    sk.close()

# http和socket
# B/S架构是http协议
# http协议基于socket的TCP协议在通信


# 为了标识new是一个前端显示的文件,我们要给他取一个后缀名 : .html










